﻿@inject LayoutService LayoutService
@using CleanArchitecture.Blazor.Server.UI.Components.Shared

<CascadingAuthenticationState>
    <Router AppAssembly="@typeof(Program).Assembly">
        <Found Context="routeData">
            <AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)">
                <Authorizing>
                    <div style="display: flex; justify-content: center; align-items: center; min-height: 60vh;">
                        <MudPaper Class="pa-8" Elevation="1" Style="max-width: 400px; text-align: center;">
                            <MudProgressCircular Indeterminate="true" Color="Color.Primary" Size="Size.Medium" Class="mb-4" />
                            <MudText Typo="Typo.h6" Color="Color.Default">"Please wait, we are authorizing you..."</MudText>
                        </MudPaper>
                    </div>
                </Authorizing>
                <NotAuthorized>
                    <ErrorPageComponent Type="ErrorPageComponent.ErrorType.AccessDenied" 
                                       ShowContactButton="true" />
                </NotAuthorized>
            </AuthorizeRouteView>
            <FocusOnNavigate RouteData="@routeData" Selector="h1"/>
        </Found>
    </Router>
</CascadingAuthenticationState>

